//
//  DBJIllCaseTagCell.m
//  DBJ
//
//  Created by Captain_czq on 16/11/14.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "DBJIllCaseTagCell.h"
#import <Masonry.h>

@interface DBJIllCaseTagCell ()

@property(nonatomic,weak)UILabel *tagLabel;
@property(nonatomic,weak)UIButton *selectedBtn;
@end

@implementation DBJIllCaseTagCell


/* 设置ui界面 */
-(void)dbjSetupUI{
    /* 设置ui界面 */
    //设置下划线
    //添加label
    self.selectionStyle=UITableViewCellSelectionStyleNone;
    //创建label
    UILabel *tagLabel=[[UILabel alloc]init];
    tagLabel.textColor=[UIColor blackColor];
    tagLabel.text=@"嘻嘻";
    //设置文本格式
    tagLabel.textAlignment= NSTextAlignmentCenter;
    tagLabel.font=[UIFont systemFontOfSize:14];
    //添加到contentView上
    [self.contentView addSubview:tagLabel];
    
    //添加选择button按钮 //可优化 直接使用系统提供的  assec~~
    UIButton *selectBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    [selectBtn setImage:[UIImage imageNamed:@"icon_yy_successful"] forState:UIControlStateNormal];
    //默认设置btn隐藏
    selectBtn.hidden=YES;
    [self.contentView addSubview:selectBtn];
    //添加分割线
//    UIView *lineView=[[UIView alloc]initWithFrame:CGRectZero];
//    [self.contentView addSubview:lineView];
//    lineView.backgroundColor=[UIColor blackColor];
    
    /* 设置约束 */
   //设置label约束
    [tagLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.contentView).offset(10);
        make.width.mas_equalTo(70);
    }];
   //设置选择btn的约束
    [selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.size.mas_equalTo(20);
    }];
    //设置下划线约束
//    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.right.bottom.equalTo(self.contentView);
//        make.height.mas_equalTo(1);
//    }];
    
    //记录属性
    self.tagLabel=tagLabel;
    self.selectedBtn=selectBtn;
}

#pragma mark -模型接口

-(void)setModel:(DBJIllCaseTagModel *)model{
    _model=model;
    self.tagLabel.text=model.name;
}

-(void)setSelceted:(BOOL)selceted{
    _selceted=selceted;
    self.selectedBtn.hidden=selceted;
}


@end
